﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class shop_Good_Comments : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {     
        if (!this.IsPostBack)
        {
            Utility.InitUltraWebGrid.InitDisplayLayOut(this.UWGComments);

            BindData();
        }
    }

    #region Web 窗体设计器生成的代码

    protected override void OnLoad(EventArgs e)
    {
        isRequestLogin = true;                                  //是否需要登录
        RequestLoginPage = this.Request.Url.AbsoluteUri;        //获取决对Url
        isAtFramePageLogin = true;                              //是框架页

        //RequestCompetences = Competences.BuildCompetencesList(Competences.Good_Comments);//页面权限

        base.OnLoad(e);
    }

    #endregion

    private void BindData()
    {
        DataTable dt = null;

        dt = new DAL.Views.V_Site_GoodComment().Open("", "Type=2 and ShopID=" + _Site.ID + "", "");
        if (dt == null) 
        {
            PublicFunction.GoError(ErrorNumber.NoData, "暂无您要查找的数据", "Good_Comments");
        }

        this.UWGComments.DataSource = dt;
        this.UWGComments.DataBind();
    }

    protected void btnDetails_Click(object sender, EventArgs e)
    {
        string ID = this.hID.Value;

        if (ID != "")
        {
            Response.Redirect("Good_Comment_Details.aspx?ID=" + ID);
        }
    }

    protected void btnDelete_Click(object sender, EventArgs e)
    {
        long ID = Shove._Convert.StrToLong(this.hID.Value, 0);
        long i = new DAL.Tables.tbl_Site_GoodComment().Delete("ID=" + ID);

        if (i < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "删除成功！");
            return;
        }

        BindData();
    }

    protected void UWGComments_PageIndexChanged(object sender, Infragistics.WebUI.UltraWebGrid.PageEventArgs e)
    {
        BindData();
    }
}
